home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
d86v322.zip
/
D02.DOC
< prev
next >
Wrap
Text File
|
1988-05-20
|
13KB
|
236 lines
CHAPTER 2 D86 DEMONSTRATION
To demonstrate some of the powers of D86, let's walk through a
D86 session.
1. Make sure your current directory contains all the files
A86.COM, D86.COM, and HEXOUT.8.
2. Assemble the HEXOUT program by typing the command A86
HEXOUT.8. The A86 assembler will create the files HEXOUT.COM
and HEXOUT.SYM. Look over the listing of the program, to get
acquainted with what it does.
3. Type the command D86 HEXOUT 41 42 5A followed by the ENTER
key. Everything following the "D86 " in the line you just
typed is what you would have typed if you had invoked HEXOUT
without the debugger-- 41 42 5A are the hex codes that HEXOUT
will turn into ABZ and send to the console. When the debugger
takes control, the screen should blank; and the D86 debugger
screen should appear. The blinking cursor should be at the
bottom left. A sign-on message should appear at the upper
right. A disassembly of the HEXOUT program should be in the
upper left. The label HEXOUT should appear on the first line,
followed on the second line by the address 0100 and the
instruction MOV SI,TAIL_BUFF. To the left of the address
should be a reverse video hash sign. If you have a CGA
monitor, the hash sign will blink, to compensate for the fact
that the reverse video isn't as obvious in the lower
resolution of CGA.
4. Notice the display of register values in the lower left
corner. The values are all 4-digit hexadecimal. At the top of
the second column of registers is a sequence of lower case
letters. This is the flags display. Each small letter stands
for a flag whose value is currently TRUE. The flags settings
are those that were handed to D86 by the operating system
starting the program; for MSDOS V3.1, the settings are "i z
e". That display indicates that the interrupt flag "i", the
zero flag "z", and the parity-even flag "e" are all TRUE; the
other flags are FALSE. To the right of the registers are six
lines labelled 1: through 6:. These are the memory window
lines. Since you haven't specified any memory windows yet,
they contain nothing but their numbers. Below the memory
window lines is a line labelled 0:. This is the stack display
line. The number 0: gives the number of words on the stack,
currently zero because nothing has been pushed onto the stack.
5. Observe that the sign-on message tells you to press Alt-F10
for help. Do so (that is, hold down the Alt key while
pressing the F10 key). You are now in help mode, where you
will remain until you press Alt-F10 again. D86 will keep
changing the help window, depending on what it thinks you are
doing. Right now you have a summary of the main function keys,
plus a few other things. Press F10 (without the Alt), and
you'll get a summary of one-letter debugger commands. Press
F10 a second time and you'll get a summary of Ctrl-key
commands. Finally, press F10 a third time to return to the
function-key help screen.
2-2
6. Let's try an immediate assembly language instruction. Press
the "M" key, which is the first letter of the immediate
instruction MOV AX,123. Note that the reverse video block
jumps from the hash sign within the disassembly, down to the
line just above the blinking cursor. The block is the
debugger's cursor; the blinking cursor is the program's
console output cursor. The debugger does not use the blinking
cursor because we do not want the program's output to
interfere with the debugger's output. Also note that the help
window is now telling you that you are typing in an assembly
language line.
7. Complete the line MOV AX,123 followed by the ENTER key (from
now on I'll assume that you know that lines are followed by
the ENTER key, and that any periods at the end of a line are
part of my sentence, and not part of what you type). The
debugger immediately executes the assembly language line you
just typed, setting the register AX. Note that you did not
have to learn a debugger command for setting registers; if you
know A86, you already know how to set registers! The value of
AX is now 007B, which may surprise you if you expected 0123.
A86's default base is 10, so 123 was taken as decimal; which
is hex 7B. Type MOV AX,0123 instead, to get a value of hex
123.
8. Let's now play with the flags display. Type the line ADD
AL,05D, which changes AL (the last two digits of AX) to hex
80, and alters the flags to "o is a ". The interrupt flag is
still on; but zero and parity-even are now off. They have
been replaced by "o" overflow, "s" sign, and "a" auxiliary
carry.
9. Type the line consisting of just CMC. This is the Complement
Carry instruction. Observe that the "c" appears. Notice also
that the CMC that you typed remains on the screen. Notice on
the help window the entry "F3 RepeatCmd". This tells you that
the F3 key will repeat the last line command (not function
key) that you typed. Press F3 several times, to see the carry
flag toggle on and off. Isn't that the cleanest flags display
you've ever seen?
10. Let's single step an instruction. Press the F1 key. This
executes the program instruction, loading the SI register
with TAIL_BUFF. The disassembly cursor moves down to the
next instruction. Observe that SI has changed to 0081, which
is the pointer to the invocation command tail, which should
contain the string typed after HEXOUT: " 41 42 5A" followed
by a carriage return code (hex 0D).
2-3
11. Let's examine memory to verify that last assertion. Press
the "1" key. The cursor jumps to the start of memory window
1, and the help window gives you a huge choice of memory
types to display. The entry "ByteHex 2" tells us that "B"
will cause hex bytes to be displayed. The "2" indicates that
the display occupies a fixed number of display bytes for
every memory unit, namely 2 hex digits. Type B followed by a
comma, to indicate that you want nothing but hex bytes to be
displayed. Now the help window asks for a segment location.
Let's use the DS register: type DS followed by a comma. Now
the help window wants an offset within the segment: type SI.
Before typing the terminating ENTER, backspace out what you
have typed, and watch the help windows regress appropriately.
Isn't that impressive? Now retype the line, "B,DS,SI". Note
that when you press ENTER, the line fills out with hex
values: 20 34 31 20 34 32 20 35 41 0D etc. (61 instead of 41
is OK; it means you typed the invocation in lower case.)
12. Let's look at the same line, displayed as text. Type "2",
moving to memory line 2, then type the line "T,SI". This
time you specified type T for text, and you left out the
segment register specification. D86 uses DS when you leave
out the segment register; so in this case you'll get the same
segment. This time the display starts with "41 42 5AM"; the
"M" is the carriage return, which is control-M, ambiguously
displayed. You can read Chapter 6 later on for descriptions
of all the types, including other text types allowing
non-ambiguous displays.
13. Let's execute the next instruction, CALL GET_HEX. Here we
have a choice, between executing the procedure all at once,
or stepping into the procedure to execute its instructions
one at a time. Let's try stepping in first: type the F1 key.
The cursor jumps to location GET_HEX, on the same disassembly
screen. The SP register decrements from FFFE to FFFC, and a
value 0106 appears on the stack. This is the return address,
pointing to the instruction following CALL GET_HEX.
14. Watch memory lines 1 and 2 as you press F1 again, single
stepping the LODSB instruction.